<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
session_start();
class ReportController extends CI_Controller {

	function __construct()
	{
		parent::__construct();
		$this->load->helper('url');
	}
	
	function loadAccomodationTallyView(){
		if(!isset($_SESSION["session_id"])) $this->load->view('ErrorNotLoggedInView');
		else{
		$this->load->model('Report_model');
		$data['info_male'] = $this->Report_model->get_count_accomodation("Male");
		$data['info_female'] = $this->Report_model->get_count_accomodation("Female");
		$data['title'] = 'Accomodation Tally';
		$this->load->model('Admin_model');
		$data['details'] = $this->Admin_model->get_details('ACCI Dormitory');
		$data['jsSnippet'] = 'jsSnippets/genericTallyJsSnippet';
		$data['htmlSnippet'] = 'htmlSnippets/accomodationTallyHtmlSnippet';
		$this->load->view('generic/GenericView',$data);}
	}
	
	function loadVacancyTallyView(){
		if(!isset($_SESSION["session_id"])) $this->load->view('ErrorNotLoggedInView');
		else{
		$this->load->model('Report_model');
		$data['info_male'] = $this->Report_model->get_count_accomodation("Male");
		$data['info_female'] = $this->Report_model->get_count_accomodation("Female");
		$data['title'] = 'Vacancy Tally';
		$this->load->model('Admin_model');
		$data['details'] = $this->Admin_model->get_details('ACCI Dormitory');
		$data['jsSnippet'] = 'jsSnippets/genericTallyJsSnippet';
		$data['htmlSnippet'] = 'htmlSnippets/vacancyTallyHtmlSnippet';
		$this->load->view('generic/GenericView',$data);}
	}
	
	/*Unrefactored code
	function loadTallyPerClassificationView(){
		$this->load->model('Report_model');
		$data['info_male'] = array($this->Report_model->get_tally_classification('Freshman','Male'),
							 $this->Report_model->get_tally_classification('Sophomore','Male'),
							 $this->Report_model->get_tally_classification('Junior','Male'),
							 $this->Report_model->get_tally_classification('Senior','Male'));
		$data['info_female'] = array($this->Report_model->get_tally_classification('Freshman','Female'),
							 $this->Report_model->get_tally_classification('Sophomore','Female'),
							 $this->Report_model->get_tally_classification('Junior','Female'),
							 $this->Report_model->get_tally_classification('Senior','Female'));
		$data['classification'] = $classification;
		$data['info_male'] = $info_male;
		$data['info_female'] = $info_female;
		$data['title'] = 'Tally Per Classification';
		$data['jsSnippet'] = 'jsSnippets/tallyPerClassificationJsSnippet';
		$data['htmlSnippet'] = 'htmlSnippets/tallyPerClassificationHtmlSnippet';
		$this->load->view('GenericView',$data);
	}*/
	
	function loadTallyPerClassificationView()
	{
		if(!isset($_SESSION["session_id"])) $this->load->view('ErrorNotLoggedInView');
		else{
		$this->load->model('Report_model');
		$classification = array("Freshman","Sophomore","Junior","Senior");
		for($i=0;$i<count($classification);$i++){
			$info_male[] = $this->Report_model->get_count_classification($classification[$i],"Male");
			$info_female[] = $this->Report_model->get_count_classification($classification[$i],"Female");
		}
		$data['classification'] = $classification;
		$data['info_male'] = $info_male;
		$data['info_female'] = $info_female;
		$data['title'] = 'Tally Per Classification';
		$this->load->model('Admin_model');
		$data['details'] = $this->Admin_model->get_details('ACCI Dormitory');
		$data['jsSnippet'] = 'jsSnippets/genericTallyJsSnippet';
		$data['htmlSnippet'] = 'htmlSnippets/tallyPerClassificationHtmlSnippet';
		$this->load->view('generic/GenericView',$data);}
	}
	
	/*Unrefactored code
	function loadTallyPerCollegeView()
	{
		$this->load->model('Report_model');
		$sql['data'] = array($this->Report_model->get_tally_college('CA'),
							 $this->Report_model->get_tally_college('CAS'),
							 $this->Report_model->get_tally_college('CA-CAS'),
							 $this->Report_model->get_tally_college('CDC'),
							 $this->Report_model->get_tally_college('CEAT'),
							 $this->Report_model->get_tally_college('CEM'),
							 $this->Report_model->get_tally_college('CFNR'),
							 $this->Report_model->get_tally_college('CHE'),
							 $this->Report_model->get_tally_college('CVM')
							 );
		$data['college'] = $college;
		$data['info'] = $info;
		$data['title'] = 'Tally Per Classification';
		$data['jsSnippet'] = 'jsSnippets/tallyPerClassificationJsSnippet';
		$data['htmlSnippet'] = 'htmlSnippets/tallyPerClassificationHtmlSnippet';
		$this->load->view('GenericView',$data);
	}
	*/
	
	function loadTallyPerCollegeView()
	{
		if(!isset($_SESSION["session_id"])) $this->load->view('ErrorNotLoggedInView');
		else{
		$this->load->model('Report_model');
		$college = array("CA","CAS","CA-CAS","CDC","CEAT","CEM","CFNR","CHE","CVM");
		for($i=0;$i<count($college);$i++){
			$info[] = $this->Report_model->get_count_college($college[$i]);
		}
		$data['college'] = $college;
		$data['info'] = $info;
		$data['title'] = 'Tally Per College';
		$this->load->model('Admin_model');
		$data['details'] = $this->Admin_model->get_details('ACCI Dormitory');
		$data['jsSnippet'] = 'jsSnippets/genericTallyJsSnippet';
		$data['htmlSnippet'] = 'htmlSnippets/tallyPerCollegeHtmlSnippet';
		$this->load->view('generic/GenericView',$data);}
	}
	
	/*Unrefactored code
	function loadTallyPerRegionalDistributionView()
	{
		$this->load->model('Report_model');
		$sql['data'] = array($this->Report_model->get_tally_regional_distribution('I'),
							 $this->Report_model->get_tally_regional_distribution('II'),
							 $this->Report_model->get_tally_regional_distribution('III'),
							 $this->Report_model->get_tally_regional_distribution('IVa'),
							 $this->Report_model->get_tally_regional_distribution('IVb'),
							 $this->Report_model->get_tally_regional_distribution('V'),
							 $this->Report_model->get_tally_regional_distribution('VI'),
							 $this->Report_model->get_tally_regional_distribution('VII'),
							 $this->Report_model->get_tally_regional_distribution('VIII'),
							 $this->Report_model->get_tally_regional_distribution('IX'),
							 $this->Report_model->get_tally_regional_distribution('X'),
							 $this->Report_model->get_tally_regional_distribution('XI'),
							 $this->Report_model->get_tally_regional_distribution('XII'),
							 $this->Report_model->get_tally_regional_distribution('XIII'),
							 $this->Report_model->get_tally_regional_distribution('NCR'),
							 $this->Report_model->get_tally_regional_distribution('CAR'),
							 $this->Report_model->get_tally_regional_distribution('CARAGA'),
							 $this->Report_model->get_tally_regional_distribution('ARMM')
							 );
		$data['region'] = $region;
		$data['info'] = $info;
		$data['title'] = 'Tally Per Regional Distribution';
		$data['jsSnippet'] = 'jsSnippets/genericTallyJsSnippet';
		$data['htmlSnippet'] = 'htmlSnippets/tallyPerRegionalDistributionHtmlSnippet';
		$this->load->view('GenericView',$data);
	}
	*/
	
	function loadTallyPerRegionalDistributionView()
	{
		if(!isset($_SESSION["session_id"])) $this->load->view('ErrorNotLoggedInView');
		else{
		$this->load->model('Report_model');
		$region = array("I","II","III","IVa","IVb","V","VI","VII","VIII","IX","X","XI","XII","XIII","NCR","CAR","CARAGA","ARMM");
		for($i=0;$i<count($region);$i++){
			$info_male[] = $this->Report_model->get_count_regional_distribution($region[$i],"Male");
			$info_female[] = $this->Report_model->get_count_regional_distribution($region[$i],"Female");
		}
		$data['region'] = $region;
		$data['info_male'] = $info_male;
		$data['info_female'] = $info_female;
		$data['title'] = 'Tally Per Regional Distribution';
		$data['jsSnippet'] = 'jsSnippets/genericTallyJsSnippet';
		$data['htmlSnippet'] = 'htmlSnippets/tallyPerRegionalDistributionHtmlSnippet';
		$this->load->view('generic/GenericView',$data);}
	}
	
}

/* End of file reportController.php */
/* Location: ./application/controllers/reportController.php */
?>